import { Entity, Column, Index } from 'typeorm';
import { BaseEntity } from '../../base/entity/base';

/**
 * 用户证照信息
 */
@Entity({ name: 'user_cert' })
export class UserCertEntity extends BaseEntity {
  @Index()
  @Column({ comment: 'Oracle业务ID', length: 50 })
  erpBusinessId: string;

  @Index()
  @Column({ comment: '序号 (来自Oracle)', nullable: true })
  xuHao: number; // XUH

  @Column({ comment: '证照名称', length: 255, nullable: true })
  certName: string; // CERTNAME

  @Column({ comment: '证照号码', length: 255, nullable: true })
  certCode: string; // CERTCODE

  @Column({ type: 'datetime', comment: '有效期至', nullable: true })
  valDate: Date; // VALDATE

  @Column({ comment: '经营范围 (原始)', type: 'text', nullable: true })
  conScope: string; // CONSCOPE

  @Column({ comment: '经营范围 (处理后)', type: 'text', nullable: true })
  businessCont: string; // CONSCOPE | | '消毒用品,一类器械,非药品'

  // 建议添加唯一约束，例如 erpBusinessId 和 xuHao 组合
  // @Index(['erpBusinessId', 'xuHao'], { unique: true })
} 